package com.tinyseed.emcp.api.exception.rest;

import com.tinyseed.emcp.api.app.common.Constant;
import com.tinyseed.emcp.api.exception.bean.ExceptionInfoInputDTO;
import com.tinyseed.emcp.api.exception.service.ExceptionInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/exceptionInfo")
public class ExceptionInfoController {

    private final ExceptionInfoService exceptionInfoService;

    public ExceptionInfoController(ExceptionInfoService exceptionInfoService) {
        this.exceptionInfoService = exceptionInfoService;
    }

    @GetMapping(value = "/list")
    public ResponseEntity list(ExceptionInfoInputDTO request, int limit, int page) {
        Page list = exceptionInfoService.getList(request, limit, page);
        return new ResponseEntity<>(list, HttpStatus.OK);

    }

    @GetMapping(value = "/EventType/list")
    public ResponseEntity getEventType() {
        return new ResponseEntity<>(Constant.EVENT_TYPE_MAP, HttpStatus.OK);

    }

}
